<f:subview
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:c="http://java.sun.com/jstl/core"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:nxl="http://nuxeo.org/nxforms/layout"
  xmlns:nxu="http://nuxeo.org/nxweb/util"
  xmlns:nxd="http://nuxeo.org/nxweb/document"
  xmlns:a4j="http://richfaces.org/a4j"
  id="#{layout.id}">

  <c:if test="#{nxl:isBoundToEditMode(layout.mode)}">

    <table class="dataInput fullWidth">
      <tbody>

      <nxl:layoutRow>
        <tr>
          <nxl:layoutRowWidget>
            <c:set var="bulkEditCheckBoxId"
              value="bulkEdit_checkbox_#{layoutRowIndex}_#{widgetIndex}" />
            <c:set var="bulkEditCheckBoxStyleClass"
              value="bulkEdit_checkbox_#{layoutRowIndex}_#{widgetIndex}" />
            <c:set var="contextDataKey"
              value="bulkEdit/#{nxl:fieldDefinitionsAsString(widget.fieldDefinitions)}" />
            <td class="iconColumn">
              <h:selectBooleanCheckbox
                id="#{bulkEditCheckBoxId}"
                value="#{value.contextData[contextDataKey]}"
                styleClass="#{bulkEditCheckBoxStyleClass}"/>
            </td>
            <td class="labelColumn">
              <c:choose>
                <c:when test="#{widget.translated}">
                  <c:if test="#{empty widget.helpLabel}">
                    <h:outputText value="#{messages[widget.label]}"
                      styleClass="#{nxu:test(widget.required, 'required', '')}" />
                  </c:if>
                  <c:if test="#{!empty widget.helpLabel}">
                    <div class="widgetHelpLabel">
                      <h:outputText value="#{messages[widget.label]}" title="#{messages[widget.helpLabel]}"
                        styleClass="tipsyShow tipsyGravityNW#{nxu:test(widget.required and isEditMode, ' required', ' ')}" />
                    </div>
                  </c:if>
                </c:when>
                <c:otherwise>
                  <c:if test="#{empty widget.helpLabel}">
                    <h:outputText value="#{widget.label}"
                      styleClass="#{nxu:test(widget.required, 'required', '')}" />
                  </c:if>
                  <c:if test="#{!empty widget.helpLabel}">
                    <div class="widgetHelpLabel">
                      <h:outputText value="#{widget.label}" title="#{widget.helpLabel}"
                        styleClass="tipsyShow tipsyGravityNW#{nxu:test(widget.required and isEditMode, ' required', ' ')}" />
                    </div>
                  </c:if>
                </c:otherwise>
              </c:choose>
            </td>
            <td class="fieldColumn" colspan="#{nxu:test(layoutRow.size==1, 3*layout.columns-2, 1)}">
              <nxl:widget widget="#{widget}" value="#{value}"
                onclick="jQuery('.#{bulkEditCheckBoxStyleClass}').attr('checked', 'checked')"
                onchange="jQuery('.#{bulkEditCheckBoxStyleClass}').attr('checked', 'checked')" />
            </td>
          </nxl:layoutRowWidget>
        </tr>
      </nxl:layoutRow>

      </tbody>
    </table>

  </c:if>

</f:subview>
